<template>
<div  class="diyCom" :style="{width:width,height:height,backgroundColor:backgroundColor}">
</div>
</template>

<script>
export default {
  name: "DiyCom",
  props: {
    myItem:{}
  },
  data(){
    return{
      width:this.myItem.propValues[1].value.num+this.myItem.propValues[1].value.unit,
      height:this.myItem.propValues[2].value.num+this.myItem.propValues[2].value.unit,
      backgroundColor:this.myItem.propValues[0].value
    }
  },
  watch:{
    myItem:{
      handler(newVal,oldVal){
        console.log(newVal.propValues)
        this.width = newVal.propValues[1].value.num+newVal.propValues[1].value.unit
        this.height = newVal.propValues[2].value.num+newVal.propValues[2].value.unit
        this.backgroundColor = newVal.propValues[0].value
      },
      deep:true
    }
  }
}
</script>

<style scoped lang="scss">
.diyCom{
  width: 100px;
  height: 100px;
  background-color: #5daf34;
}
</style>
